<template>
  <a-textarea v-bind="$attrs" :value="fakeValue" :rows="rowNum" @change="onChange" />
</template>
<script>
export default {
  // 继承
  name: 'STextArea',
  props: {
    modelValue: {
      required: false
    },
    rowNum: {
      type: Number,
      required: false,
      default: 4
    }
  },
  emits: ['change', 'update:modelValue'],
  data() {
    return {
      fakeValue: this.modelValue
    }
  },
  watch: {
    modelValue(val) {
      this.fakeValue = val
    }
  },
  methods: {
    onChange(e) {
      this.$emit('update:modelValue', e.target.value)
      this.$emit('change', e.target.value)
    }
  }
}
</script>
